//二分查找
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int target = in.nextInt();
        int[] nums = new int[n];
        for(int i = 0;i<n;i++){
            nums[i] = in.nextInt();
        }
        System.out.println(search(nums,target));
    }
    public static int search(int[] nums, int target) {
        //因为有序
        int left = 0,right = nums.length-1;
        while (left<=right){
            int mid = (right-left)/2+left;
            if(nums[mid]==target){
                return mid;
            } else if (nums[mid]<target) {
                left = mid+1;
            } else if (nums[mid]>target) {
                right=mid-1;
            }
        }
        return -1;
    }
}
